<%@page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<%@include file="/includes/taglibs.jsp"%>
<%@page import="com.feib.soeasy.util.UserUtil"%>
<%@page import="com.feib.soeasy.util.CodeTableUtil"%>

<script type="text/javascript">
<!--
$(document).ready(function() {
	
	
	$('#printBtn2').click(function() {
		//window.print();
		//doQueryPrintAction();
		divPrint('queryResultDiv');//只印目前這筆
	});
	

	$("[id^='radioUploadFile-']").click(function() {
		var uploadFilePk = this.id.substring(16);
		$('#hidden\\.uploadFilePk').val(uploadFilePk);
		
	});
	
	$("[id^='viewUploadFileImg-']").click(function() {
		var uploadFilePk = this.id.substring(18);
		doQueryPaymentsAction(uploadFilePk , 1);
		
	});
	
	$("[id^='doDownloadFile']").click(function() {
		
	});
});

	function checkUploadFileRadio()
	{
		var uploadFilePk = $('#hidden\\.uploadFilePk').val();
		if(uploadFilePk == '')
		{
			alert('請選擇下載帳單!!');
			return false;
		}
	}
//-->
</script>
	
<c:choose>
	<c:when test="${null != actionBean.queryResult && not empty actionBean.queryResult.paginatedList}">
		<table id="listTable">
			<thead>
				<tr>
					<th></th>
					<th>上傳日期</th>
					<th>檔案名稱</th>
					<th>上傳格式</th>
					<th>上傳人員</th>
					<th>總筆數</th>
					<th>總金額</th>
					<%if ( UserUtil.isBankGroup()){ %>
					<th>業者名稱</th>
					<%} %>
					<th></th>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${actionBean.queryResult.paginatedList}" var="viewObj" varStatus="rowstat">
				<tr>
					<td>
						<input type="radio" id="radioUploadFile-<c:out value='${viewObj.uploadFilePk}'/>" 
							name="radioUploadFile" 
							value="<c:out value='${viewObj.uploadFilePk}'/>"/>
					</td>
					<td align="center"><fmt:formatDate value="${viewObj.uploadDate}" pattern="yyyy/MM/dd" /><br/>
						<fmt:formatDate value="${viewObj.uploadDate}" pattern="HH:mm:ss" />
					</td>
					<td><c:out value="${viewObj.fileName}"/></td>
					<td><c:out value="${viewObj.formatDefinition.formatName}"/></td>
					<td><c:out value="${viewObj.uploadUser.userName}"/></td>
					<td align="right"><fmt:formatNumber value="${viewObj.totalItems}" pattern="##,###" /></td>
					<td align="right"><fmt:formatNumber value="${viewObj.totalAmount}" pattern="##,###" /></td>
					<%if ( UserUtil.isBankGroup()){ %>
					<td><c:out value="${viewObj.group.groupName}" /></td>
					<%} %>
					<td>
					<div id="viewUploadFileImg-<c:out value='${viewObj.uploadFilePk}'/>"><a href="javascript: void(0)" class="btnZoom">查詢</a></div>
						
					</td>			
				</tr>
				</c:forEach>
			</tbody>
		</table>
			
		
		<stripes:form id="queryUploadFileFrom" beanclass="com.feib.soeasy.action.Soez3002ActionBean" 
			method="post">
			<table id="listTable">
				<tr>
					<td align="center">
						<stripes:submit id="doDownloadUploadFileAction" name="doDownloadUploadFileAction"  value="下載帳單"
						onclick="return checkUploadFileRadio();"/>
						<input type="button" id="printBtn2" value="列印" />	
						<stripes:hidden id="hidden.uploadFilePk" name="uploadFilePk"/>
					</td>
				</tr>
			</table>
		</stripes:form>
		
	</c:when>
	<c:otherwise>
		<div id="queryNothingBlockDiv" style="display: none;">
			查無資料
		</div>
		
<script type="text/javascript">
<!--
$(document).ready(function() {
	$( "#queryNothingBlockDiv" ).dialog( "destroy" );
	$( "#queryNothingBlockDiv" ).dialog({  title:'<%=UserUtil.getCurrentMenuItemName() %>查詢' ,width: 300, resizable: false, modal: true, buttons : {
		Ok : function() {
			$(this).dialog("close");
		}
	}  });
});
//-->
</script>
	</c:otherwise>
</c:choose>
